package cn.edu.scau.cmi.houzhicong.client;

import cn.edu.scau.cmi.houzhicong.interProgramming.domain.A;
import cn.edu.scau.cmi.houzhicong.interProgramming.domain.B;
import cn.edu.scau.cmi.houzhicong.interProgramming.domain.C;
import cn.edu.scau.cmi.houzhicong.singletonPattern.domain.SingleChairMan;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class InterProgrammingClient extends Application {

    private Text text = new Text();
    @Override
    public void start(Stage primaryStage) {
        try {
            Pane vBox = new VBox();
            Button addButton = new Button("运行");

            addButton.setOnAction(e->{
                A a = null;
                a = new B();
                String s = "a = new B(), a said："+a.doSomething()+"\n";
                a = new C();
                s = s+"a = new C(), a said："+a.doSomething()+"\n";
                text.setText(s);
            });

            addButton.setPrefSize(100,30);
            vBox.getChildren().add(addButton);
            vBox.getChildren().add(text);

            Scene scene = new Scene(vBox,250,100);
            primaryStage.setScene(scene);
            primaryStage.show();

        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}
